package agh.tk.markuptranslation;

public class Mail extends AbstractComponent
{
	/*
	 * left - adres mailowy
	 * right - opis adresu mailowego
	 */
	public Mail(IComponent left, IComponent right) 
	{
		super(left, right);
	}
	@Override
	public String toDokuWiki()
	{ 
		StringBuilder stringBuilder = new StringBuilder() ;
		stringBuilder.append('<') ;
		stringBuilder.append(super.leftChild.toDokuWiki()) ;
		stringBuilder.append('>') ;
		return stringBuilder.toString() ;
	}
	@Override
	public String toMediaWiki()
	{
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.append("[mailto:");
		stringBuilder.append(super.toMediaWiki(" "));
		stringBuilder.append(']');
		return stringBuilder.toString();
	}
	
	@Override
	public String toHTML() {
		StringBuilder stringBuilder  = new StringBuilder("<a href=\"mailto:");
		stringBuilder.append(leftChild.toHTML());
		stringBuilder.append("\">");
		if(rightChild != null)
			stringBuilder.append(rightChild.toHTML());
		else
			stringBuilder.append(leftChild.toHTML());
		stringBuilder.append("</a>");
		return stringBuilder.toString() ;
	}
	
	@Override
	public String toTxt2tags() 
	{
		return super.leftChild.toTxt2tags() ;
	}

}
